#import "ALChartDetailBackgroundView.h"


#pragma mark Constants
static const CGFloat kALChartDetailBackgroundUpperGradientHeight = 90.0f;


#pragma mark -
#pragma mark Class Globals
static NSGradient *ALChartDetailBackgroundUpperGradient;
static NSColor *ALChartDetailBackgroundColor;


#pragma mark -
@implementation ALChartDetailBackgroundView

+(void)initialize {
    ALChartDetailBackgroundColor = [NSColor colorWithCalibratedRed:0.138 green:0.154 blue:0.177 alpha:1.000];
    NSColor *topColor = [NSColor colorWithCalibratedRed:0.071 green:0.080 blue:0.091 alpha:1.000];
    ALChartDetailBackgroundUpperGradient = [[NSGradient alloc] initWithStartingColor:topColor endingColor:ALChartDetailBackgroundColor];
}

-(void)drawRect:(NSRect)dirtyRect {
    [ALChartDetailBackgroundColor setFill];
    NSRect bounds = [self bounds];
    [NSBezierPath fillRect:bounds];
    NSRect gradientRect = NSMakeRect(bounds.origin.x, NSMaxY(bounds) - kALChartDetailBackgroundUpperGradientHeight, bounds.size.width, kALChartDetailBackgroundUpperGradientHeight);
    [ALChartDetailBackgroundUpperGradient drawInRect:gradientRect angle:270.0f];
}

@end
